function GenerateBisectingLineXYSequence(seqLen,minAngle,maxAngle,offsetPixels,borderSize)

addpath('/Users/marcelomattar/Dropbox/Marcelo/UPenn/Documents/Projects/AdaptID/StimSet/etc/v2_0');

% minAngle and maxAngle are entered in degrees
% offset is entered in #pixels from the midpoint between the eyes

% Midpoint between the eyes:
pointXY = [145 150];

angleSeq = rand(1,seqLen)*(maxAngle-minAngle) + minAngle;

offsetSeq = rand(1,seqLen);
offsetSeq  = offsetSeq > 0.5;
offsetSeq = offsetSeq + 0;
offsetSeq(offsetSeq==0) = -1;
offsetSeq = offsetSeq .* offsetPixels;

XYcoordFile = fopen('./bisectLineCoords.txt','w');
angleFile = fopen('./angleSeq.txt','w');
offsetFile = fopen('./offsetSeq.txt','w');
for i=1:(seqLen-1)
    [topline, bottomline] = bisectingLine('alphaImg.mat', pointXY, angleSeq(i), offsetSeq(i), borderSize);
    fprintf(XYcoordFile, [num2str(topline(1,1)) ' ' num2str(topline(2,1)) ' ' num2str(topline(1,2)) ' ' num2str(topline(2,2)) ...
        ' ' num2str(bottomline(1,1)) ' ' num2str(bottomline(2,1)) ' ' num2str(bottomline(1,2)) ' ' num2str(bottomline(2,2)) '\n']);
    fprintf(angleFile, [num2str(angleSeq(i)) '\n']);
    fprintf(offsetFile, [num2str(offsetSeq(i)) '\n']);
end

[topline, bottomline] = bisectingLine('alphaImg.mat', pointXY, angleSeq(end), offsetSeq(end), borderSize);
fprintf(XYcoordFile, [num2str(topline(1,1)) ' ' num2str(topline(2,1)) ' ' num2str(topline(1,2)) ' ' num2str(topline(2,2)) ...
        ' ' num2str(bottomline(1,1)) ' ' num2str(bottomline(2,1)) ' ' num2str(bottomline(1,2)) ' ' num2str(bottomline(2,2))]);
fprintf(angleFile, [num2str(angleSeq(end)) '\n']);
fprintf(offsetFile, [num2str(offsetSeq(end)) '\n']);

fclose(XYcoordFile);
fclose(angleFile);
fclose(offsetFile);